package com.xiaoyy.app.extend.gateway.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 * @description:
 * @author: chenzh
 * @time: 2020/4/19 19:40
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    /**
     * 业务接口
     * */
    @Bean
    public Docket createBusinessApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xiaoyy.app.extend"))
                .paths(PathSelectors.any())
                .build()
                .groupName("扩展服务接口");
    }

    /**
     * api信息
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("接口管理系统")
                .description("接口文档")
                .contact(new Contact("chenzh", "", "845078693@qq.com"))
                .version("1.0")
                .build();
    }

}
